package mylist;
import java.util.*;
public class Test {
    public List<List<Integer>> generate(int numRows){
        List<List<Integer>> ret=new ArrayList<>();
        List<Integer> list=new ArrayList<>();
        list.add(1);
        ret.add(list);
        for(int i=0;i<numRows;i++){
            List<Integer> curRow=new ArrayList<>();
            curRow.add(1);
            List<Integer> prevRow=ret.get(i-1);
            for(int j=1;j<i;j++){
                int val=prevRow.get(j)+prevRow.get(j-1);
                curRow.add(val);
            }
            curRow.add(1);
        }
        return ret;
    }

    public static void main(String[] args) {
        MyArrayList myArrayList = new MyArrayList();
        myArrayList.add(1);//0
        myArrayList.add(2);//1
        myArrayList.add(199);//2
        myArrayList.display();

        //myArrayList.set(2,88888);

        //myArrayList.display();

        myArrayList.remove(199);
        myArrayList.display();

        myArrayList.clear();
        System.out.println("====");
        myArrayList.display();


    }
}
